
<!--售票员差异数据来源替换-->
<template>
  <div class="mergeInfo">
    <basic-container>
      <el-dialog
        title="售票员差异数据来源替换"
        :visible.sync="dialogVisible"
        @close="closed"
        width="950px">
        <div style="line-height: 40px;background-color: #fcf7f7;padding-left: 15px">
          <span>线路：</span><span>{{getLineName(formData.lineCode)}}</span>
          <span style="margin-left: 20px">站点：</span><span>{{getStationName(formData.lineCode,formData.stationCode)}}</span>
          <span style="margin-left: 20px">售票员名称：</span><span>{{formData.conductorPersonName}}</span>
          <span style="margin-left: 20px"> 实收金额：</span><span>{{fenExYuangettoFixed(formData,'paidAmount')}} 元</span>
	  <span style="margin-left: 20px"> 营销车票金额：</span><span>{{fenExYuangettoFixed(formData,'marketTicketAmount')}} 元</span>
          <span style="margin-left: 20px"> 乘客事务金额：</span><span>{{fenExYuangettoFixed(formData,'passengerWorkAmount')}} 元</span>
          <span style="margin-left: 20px"> 预制单程票金额：</span><span>{{fenExYuangettoFixed(formData,'singleTicketAmount')}} 元</span>
	  <span style="margin-left: 20px"> 应急纸票金额：</span><span>{{fenExYuangettoFixed(formData,'emergencyAmount')}} 元</span>
	  <span style="margin-left: 20px"> 收入日期：</span><span>{{formData.recordTime}}</span>
        </div>
      <avue-crud
        ref="mergeInfo"
        :option="option"
        :data="list"
        :page.sync="page">
        <template slot-scope="scope" slot="menu">
          <!-- <el-button type="text" size="small" v-if="scope.row.auditState==0 && scope.row.sellAmount==0 && scope.row.investAmount==0
           && scope.row.faretkAmount==0&& scope.row.type!='spy' " plain @click.stop="spy_freshAmount(scope.row)">刷新</el-button> --> 
	   <el-button type="text" size="small" v-if="scope.row.auditState==0 && scope.row.type!='spy' " plain @click.stop="spy_freshAmount(scope.row)">刷新</el-button>
          <el-button type="text" size="small" v-if="scope.row.auditState==0" plain @click.stop="replaceSystemAmounts(scope.row)">替换</el-button>
        </template>
      </avue-crud>
        <div style="width: 100%;text-align: center;margin-top: 20px">
          <el-button type="primary" size="mini"  @click="closed">返回</el-button>
        </div>
      </el-dialog>
    </basic-container>

  </div>

</template>

<script>
  import {getForm, postForm} from '@/api/gen/gen'
  import {mapGetters} from 'vuex';
  import { setSearchFiledsEmpty,getStationName,getLineName,fenExYuangettoFixed
  } from "../../../../api/subwayRat/commonCheck";
  import {
    getMergeOption, getReplaceOption,
    getSwAuCenterConductorAmountDifferenceList, replaceSystemAmount, mondifyData, spy_freshAmount
  } from "../../../../api/subwayRat/conductorDifferences/conductorTicketChaYiShenhe/conductorTicketChaYiShenhe";
  export default {
    name: 'huLianWangShouPiaojiDataInput',
    components:{
    },
    data() {
      return {
        dialogVisible:false,
        option: {},
        listLoading: true,
        lineCodes:[],
        stationCodes:[],
        selectKeys:[],
        formData:{},
        selectKeyVals:[],
        searchForm:{},
        page: {
          total: 0, // 总页数
          currentPage: 1, // 当前页数
          pageSize: 20, // 每页显示多少条,
          isAsc: false// 是否倒序
        },
        list : []
      }
    },
    computed: {
      ...mapGetters(['permissions']),
    },
    watch: {
    },
    created() {
      this.option=getReplaceOption();
    },
    methods: {
      getStationName,getLineName,
      fenExYuangettoFixed,
      setSearchFiledsEmpty,
      getLists(row) {         
        this.formData=row;
        this.list=mondifyData(row);
      },
      replaceSystemAmounts(row){
        let th=this;
        replaceSystemAmount({ids:row.id,dataSource:row.type}).then(res=>{
          if(res.data.code==0){
            th.$message.success("操作成功！");
            th.$parent.getList();
            th.closed();
          }else{
            th.$message.error("操作失败！");
          }
        })
      },
      spy_freshAmount(row){
        let th = this;
        this.formData.dataSourcetype=row.type;
        spy_freshAmount(this.formData).then(res=>{
          th.list=mondifyData(res.data.data,"1");
        })
        th.$message.success("操作成功！");
      },
      closed(){
        this.dialogVisible=false;
        this.$parent.isShowMergeInfo=false;
      }
    },
    mounted() {

    }
  }
</script>
<style lang="scss">
  .huLianWangShouPiaojiDataInput {
    height: 100%;

    &__tree {
      padding-top: 3px;
      padding-right: 20px;
    }

    &__main {
      .el-card__body {
        padding-top: 0;
      }
    }
    .avue-form__group{

    }
  }
</style>
